/**
 * 用户认证相关API
 */
import { post } from './request'

// 游客登录
export function guestLogin(deviceId) {
  return post('/user/login', {
    mode: 'guest',
    device_id: deviceId
  })
}

// 手机号登录
export function phoneLogin(phone, code, agreed) {
  return post('/user/login', {
    mode: 'phone',
    phone,
    code,
    agreed
  })
}

// 发送验证码
export function sendCode(phone) {
  return post('/user/send_code', {
    phone
  })
}

// 获取用户信息
export function getUserInfo() {
  return post('/user/info')
}

// 登出
export function logout() {
  return post('/user/logout')
}

export default {
  guestLogin,
  phoneLogin,
  sendCode,
  getUserInfo,
  logout
}